﻿package mortal.game.view.systemHistory
{
    import com.gengine.global.*;
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.mvc.core.*;

    public class SysHistroyBtn extends View
    {
        private var _btn:GLoadingButton;
        private static var _instance:SysHistroyBtn;

        public function SysHistroyBtn()
        {
            this.layer = LayerManager.uiLayer;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._btn = UIFactory.gLoadingButton(ResFileConst.SysHistoryDetailBtn, 0, 0, 24, 24, this);
            this._btn.configEventListener(MouseEvent.CLICK, this.onClickBtn);
            return;
        }// end function

        protected function onClickBtn(event:MouseEvent) : void
        {
            switch(this._btn.styleName)
            {
                case ResFileConst.SysHistoryDetailBtn:
                {
                    SysHistroyWindow.instance.show();
                    this._btn.styleName = ResFileConst.SysHistoryReduceBtn;
                    break;
                }
                case ResFileConst.SysHistoryReduceBtn:
                {
                    this._btn.styleName = ResFileConst.SysHistoryAddBtn;
                    MsgManager.showHideTipText(false);
                    break;
                }
                case ResFileConst.SysHistoryAddBtn:
                {
                    this._btn.styleName = ResFileConst.SysHistoryDetailBtn;
                    MsgManager.showHideTipText(true);
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._btn.dispose();
            this._btn = null;
            super.disposeImpl();
            return;
        }// end function

        override public function stageResize() : void
        {
            this.x = Global.stage.stageWidth - 24;
            this.y = Global.stage.stageHeight - 133;
            return;
        }// end function

        public static function get instance() : SysHistroyBtn
        {
            if (!_instance)
            {
                _instance = new SysHistroyBtn;
            }
            return _instance;
        }// end function

    }
}
